In [1]:
%matplotlib inline

First steps in Programming with Phyton

01.Hello, SoftUni

Print "Hello, SoftUni".


In [2]:
print("Hello SoftUni")


Hello SoftUni

02.Expression

Print the result.


In [3]:
print((3522 + 52353) * 23 - (2336 * 501 + 23432 - 6743) * 3)


-2275950

03.Nums 1...20

Print the numbers: 1...20


In [8]:
for i in range(0,20):
    print(i + 1)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

04.Triangle of 55 Stars

Write a Python console program that prints a triangle of 55 asterisks located in 10 rows:


In [16]:
for i in range(0,10):
    print("*" * (i + 1))


*
**
***
****
*****
******
*******
********
*********
**********

05.Rectangle Area

Write a Python program that reads from the console two numbers a and b, calculates and prints the face of a rectangle with sides a and b.


In [17]:
a = int(input())
b = int(input())

s = a * b

print(s)


5
5
25

06.Square of Stars

Write a Python console program that reads a positive N integer from the console and prints a console square of N asterisks.


In [18]:
n = int(input())

print("*" * n)

for num in range(1,n -1):
    print("*" + " " *( n-2) + "*")

print("*" * n)


5
*****
*   *
*   *
*   *
*****